#ifndef blob_detect
#define blob_detect

#include "stdafx.h"
#include "highgui.h"
#include "cv.h"
#include <iostream>
#include <stdio.h>
#include <conio.h>
#include <cxcore.h>

using namespace std;
using namespace cv;

#define WHITE 255;
#define BLACK 0;

#define UPPERRIGHT 4;
#define UPPERLEFT 8;
#define LOWERLEFT 2;
#define LOWERRIGHT 1;

#define PREVUP 8;
#define PREVDOWN 4;
#define PREVLEFT 2;
#define PREVRIGHT 1;


class BlobDetector{

public:

	int  MassRowL, MassColL, LastTransX, LastTransY, LastMassRow, LastMassCol;
	
	BlobDetector()
	:LastMassCol(0),
	LastMassRow(0)
	{};

	Mat Frame, ImgHSV, Scratch, WorkImage, GrayscaleImage, BinaryImage, Image;
	VideoCapture Cam;

	void loadImage(const string& filename);
	void LoadLiveFeed(VideoCapture Cam);

	void Crosshair();

	void blank();

	void MoveUp();
	void MoveDown();
	void MoveLeft();
	void MoveRight();

	void BackgroundBorder();
	void BackgroundBorder(Mat Image);

	int Image_Scan();
	int Image_Scan(Mat WorkImage);

	void Follow_Contour();
	void Follow_contour(Mat WorkImage);
	void Follow_contour(Mat WorkImage, bool DrawContour);

private:
	int x, y, Ycor, Xcor, AreaRow, AreaCol, MinRow, MinCol, MaxRow, MaxCol, Area, AreaL, MassRow, MassCol;
	int Row, Col, SumRow, SumCol;

	uchar PrevPixel, PrevMove;
	Vec3b pixelElement;
};



#endif